<?php
require_once("vcl/vcl.inc.php");
require_once("lib/db_connection.php");
//Includes
use_unit("components4phpfull/jtjavascript.inc.php");
use_unit("components4phpfull/jtsitetheme.inc.php");
use_unit("platinumgrid/jtplatinumgrid.inc.php");
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");

//Class definition
class Prospect_List extends Page
{
       public $btnSearch = null;
       public $edSearch = null;
       public $Image4 = null;
       public $JTJavaScript1 = null;
       public $add = null;
       public $Image2 = null;
       public $JTPlatinumProspectList = null;
       public $JTSiteTheme1 = null;

       function edSearchJSClick($sender, $params)
       {

       ?>
       document.getElementById('edSearch').value = '';

       <?php

       }

       function addJSClick($sender, $params)
       {

       ?>
       var win_height = 312;
       var win_width = 424;
       var height = window.outerHeight;
       var width = window.outerWidth;
       var top = Math.round((height-win_height)/2);
       var left = Math.round((width-win_width)/2);

       window.open("prospect_create.php","Window1",'location=no,height='+win_height+',width='+win_width+',top='+top+',left='+left);

       <?php

       }



       function Prospect_ListCreate($sender, $params)
       {
       //$this->add->setLink("prospect_create.php");


       }

       function addJSMouseOut($sender, $params)
       {

       ?>
       document.images['add'].src="image/add_new.png";

       <?php

       }

       function addJSMouseOver($sender, $params)
       {

       ?>
       document.images['add'].src="image/add_new_blue.png";
       <?php

       }




       function JTPlatinumProspectListShow($sender, $params)
       {
        $arr = array();
        $query_prospects = "select * from prospects_tbl WHERE
        comp_name LIKE '%".$this->edSearch->Text."%' OR
        business_add LIKE '%".$this->edSearch->Text."%' OR
        email_add LIKE '%".$this->edSearch->Text."%' OR
        contact_person LIKE '%".$this->edSearch->Text."%' OR
        contact_num LIKE '%".$this->edSearch->Text."%'
        ";
        $result_prospects = mysql_query($query_prospects)or die('SELECT PROSPECTS'.mysql_error());


        while($row_prospects = mysql_fetch_array($result_prospects))
          {
          $autoid = $row_prospects['autoid'];
          $tools = "<a href=prospect_update_list.php?company_id=".$autoid."><img src='image/update_list.png' title='List of Updates' no border></a>";
          $comp_name = "<span onclick=editPros(".$autoid.") title='Edit' style='color:blue;text-decoration:underline;cursor:pointer;'>".$row_prospects['comp_name']."</span>";
          $arr[] = array(
                        'Company Name' => $comp_name,
                        'Address' => $row_prospects['business_add'],
                        'Email Address' => $row_prospects['email_add'],
                        'Contact Person' => $row_prospects['contact_person'],
                        'Contact Number' => $row_prospects['contact_num'],
                        'Tools' => $tools
                        );
          }
          $this->JTPlatinumProspectList->setCellData($arr);

       }



}

global $application;

global $Prospect_List;

//Creates the form
$Prospect_List=new Prospect_List($application);

//Read from resource file
$Prospect_List->loadResource(__FILE__);

//Shows the form
$Prospect_List->show();

?>